<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $this->systemName;?></title>
<link rel="stylesheet" href="<?php echo $this->baseUrl;?>/files/admin/css/main.css" />
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/jquery.js"></script>
</head>

<body>
	<div id="main">
		<div id="navigation">当前位置：<a href="<?php echo $this->projectUrl(array('action'=>'index'));?>">角色列表</a> &gt; <span id="focus">编辑角色</span></div>
		<div id="body">
			<div id="edit">
				<form id="editForm" name="editForm" method="post" action="">
					<table class="table">
						
						<tr>
							<td width="20%">角色名：</td>
							<td>
								<input name="name" type="text" class="input" id="name" value="<?php echo $this->row['name'];?>" size="30" style="width:300px;" /></td>
						</tr>
						<tr>
							<td>角色类型：</td>
							<td>
								<label>
									<input name="type" type="radio" id="type1" class="type" value="1" <?php echo $this->row['type'] == 1 ? 'checked="checked"' : '';?> /> YEK								</label>
								<label>
									<input type="radio" name="type" id="type2" class="type" value="2" <?php echo $this->row['type'] == 2 ? 'checked="checked"' : '';?>/> 商家								</label>							</td>
						</tr>
						<tr id="partnerBlock">
							<td width="20%">所属公司：</td>
							<td>
								<select name="partnerCode" id="partnerCode">
									<option value="">选择</option>
<?php
foreach($this->partnerRows as $row) {
?>
									<option value="<?php echo $row['code'];?>" <?php echo $this->row['partnerCode'] == $row['code'] ? ' selected' : '';?>><?php echo $row['name'];?>（<?php echo $row['code'];?>）</option>
<?php
}
?>
								</select>
							</td>
						</tr>
						<tr>
							<td width="20%">说明：</td>
							<td><textarea name="notes" cols="30" rows="5" class="input" id="notes" style="width:300px;"><?php echo $this->row['notes'];?></textarea></td>
						</tr>
						<tr>
							<td width="20%">&nbsp;</td>
							<td><input type="submit" name="button" id="button" value="提交" class="button"/></td>
						</tr>
					</table>
				</form>
			</div>
		</div>
	</div>
<script language="javascript">
$("#boxForm").submit(function(){
	if ($.trim($("#Name").val()) == '') {
		alert('请输入角色名称。');
		$("#Name").focus();
		return false;
	}
	var type = null;
	$(".type").each(function(){
		if ($(this).attr('type') == 'radio' && $(this).attr('checked') == true) {
			type = this.value;
		}
	});
	if (type == 2 && $.trim($("#PartnerCode").val()) == '') {
		alert('请输选择一个公司。');
		$("#PartnerCode").focus();
		return false;
	}
});
</script>

<script language="javascript">
$(".type").click(function(){setType();});
function setType()
{
	var type = null;
	$(".type").each(function(){
		if ($(this).attr('type') == 'radio' && $(this).attr('checked') == true) {
			type = this.value;
		}
	});
	if (type == 1) {
		$("#partnerBlock").css('display', 'none');
	} else {
		$("#partnerBlock").css('display', '');
	}
}
$(".type").click(function(){setType();});
setType();
</script>
</body>
</html>